﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Fittings.aspx.cs" Inherits="Jy123.Web.Manage.Fittings" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>管理赛车配件</title>
    <link href="css/custom/jquery.ui.css" rel="stylesheet" type="text/css" />
    <link href="css/main.css" rel="stylesheet" type="text/css" />

    <script src="js/jquery.js" type="text/javascript"></script>

    <script src="js/jquery.ui.js" type="text/javascript"></script>

    <script src="js/main.js" type="text/javascript"></script>

    <script type="text/javascript" language="javascript">
    function Validate(){ 
        var fileUploadSmall=document.getElementById('<%=fileUploadSmall.ClientID %>');
        var fileUploadBig=document.getElementById('<%=fileUploadBig.ClientID %>');
        var actionHidden=document.getElementById('<%=actionTypeHidden.ClientID %>');
        var button=document.getElementById('<%=SaveButton.ClientID %>');
        button.disabled=""; 
        var fileName;
        var index;
        var length;
        var fileType;       
        if(fileUploadSmall.value==''){        
            if(actionHidden.value=='Add'){
                $("#noSmallLogoSpan").css('display','block');
                $("#errorSmallLogoSpan").css('display','none');
                button.disabled="disabled";                
            }
        }else{
            $("#noSmallLogoSpan").css('display','none');
            fileName=fileUploadSmall.value;
            index=fileName.lastIndexOf(".")+1;
            length=fileName.length-fileName.lastIndexOf(".")-1;                                                  
            fileType=fileName.substr(index,length);           
           if(fileType=='jpg'||fileType=='gif'||fileType=='tiff'||fileType=='jpeg'||fileType=='png'||fileType=='bmp'){
                $("#errorSmallLogoSpan").css('display','none');
                $("#propsSmallImage").attr("src",fileUploadSmall.value);       
           }else{
                $("#errorSmallLogoSpan").css('display','block');
                button.disabled="disabled";                 
           }          
        }
        
        if(fileUploadBig.value==''){        
            if(actionHidden.value=='Add'){
                $("#noBigLogoSpan").css('display','block');
                $("#errorBigLogoSpan").css('display','none');
                button.disabled="disabled";                
            }
        }else{
            $("#noBigLogoSpan").css('display','none');
            fileName=fileUploadBig.value;
            index=fileName.lastIndexOf(".")+1;
            length=fileName.length-fileName.lastIndexOf(".")-1;                                                  
            fileType=fileName.substr(index,length);           
           if(fileType=='jpg'||fileType=='gif'||fileType=='tiff'||fileType=='jpeg'||fileType=='png'||fileType=='bmp'){
                $("#errorBigLogoSpan").css('display','none');
                $("#propsBigImage").attr("src",fileUploadBig.value)            
           }else{
                $("#errorBigLogoSpan").css('display','block');
                button.disabled="disabled";                 
           }          
        }
      }
    </script>

    <style type="text/css">
        .carimg
        {
            border: 3px solid #CECABC;
            padding: 2px;
            width: 150px;
            height: 101px;
            margin-left: 70px;
            margin-bottom: 15px;
        }
    </style>
</head>
<body>
    <h4>
        <a href="#"><span>赛车配件管理</span></a></h4>
    <form id="manageJTypeForm" runat="server">
    <div class="register">
        <h5>
            配件类型名称
        </h5>
        <ul>
            <li>
                <asp:TextBox ID="fittingsNameTextBox" runat="server" MaxLength="20" CssClass="text"
                    onblur="Validate()"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="fittingsNameRequired" CssClass="warning" runat="server"
                    ControlToValidate="fittingsNameTextBox" ErrorMessage="请填写配件类型名称" Display="Dynamic"
                    ForeColor=""></asp:RequiredFieldValidator>
            </li>
        </ul>
        <h5>
            提升速度
        </h5>
        <ul>
            <li>
                <asp:TextBox ID="fittingsSpeedTextBox" runat="server" CssClass="text" onblur="Validate()"></asp:TextBox>
            </li>
            <li>
                <asp:RangeValidator ID="RangeValidator1" CssClass="warning" runat="server" ControlToValidate="fittingsSpeedTextBox"
                    ErrorMessage="请填写1－1000之间的整数" Type="Integer" MinimumValue="1" MaximumValue="1000"></asp:RangeValidator>
            </li>
        </ul>
        <h5>
            提升稳定性
        </h5>
        <ul>
            <li>
                <asp:TextBox ID="fittingsStabilityTextBox" runat="server" CssClass="text" onblur="Validate()"></asp:TextBox>
            </li>
            <li>
                <asp:RangeValidator ID="RangeValidator2" CssClass="warning" runat="server" ControlToValidate="fittingsStabilityTextBox"
                    ErrorMessage="请填写1－1000之间的整数" Type="Integer" MinimumValue="1" MaximumValue="1000"></asp:RangeValidator>
            </li>
        </ul>
        <h5>
        配件价格
        </h5>
        <ul>
            <li>
                <asp:TextBox ID="priceTextBox" runat="server" CssClass="text" onblur="Validate()"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" CssClass="warning" runat="server"
                    ControlToValidate="priceTextBox" ErrorMessage="请填写赛车价格" Display="Dynamic" ForeColor=""></asp:RequiredFieldValidator>
            </li>
            <li class="sliderli">
                <div id="Div1" class="slider">
                    <ul>
                    </ul>
                </div>
            </li>
            <li>
                <asp:RangeValidator ID="RangeValidator3" CssClass="warning" runat="server" ControlToValidate="priceTextBox"
                    ErrorMessage="请填写1－99999999之间的整数" Type="Integer" MinimumValue="1" MaximumValue="99999999"
                    Display="Dynamic" ForeColor=""></asp:RangeValidator>
            </li>
        </ul>
        <h5>
        显示顺序
        </h5>
        <ul>
            <li>
                <asp:TextBox ID="displayOrderTextBox" runat="server" CssClass="text" onblur="Validate()"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" CssClass="warning" runat="server"
                    ControlToValidate="displayOrderTextBox" ErrorMessage="请填写配件显示顺序" Display="Dynamic" ForeColor=""></asp:RequiredFieldValidator>
            </li>            
            <li>
                <asp:RangeValidator ID="RangeValidator4" CssClass="warning" runat="server" ControlToValidate="displayOrderTextBox"
                    ErrorMessage="请填写0－99999999之间的整数" Type="Integer" MinimumValue="0" MaximumValue="99999999"
                    Display="Dynamic" ForeColor=""></asp:RangeValidator>
            </li>
        </ul>
        <h5>
            配件适用车型
        </h5>
        <ul>
            <li>
                <asp:DropDownList ID="fatherDropDown" runat="server">
                </asp:DropDownList>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" CssClass="warning" runat="server"
                    ControlToValidate="fatherDropDown" ErrorMessage="请选择配件适用车型" Display="Dynamic"
                    ForeColor="" InitialValue="-1"></asp:RequiredFieldValidator>
            </li>
        </ul>
        <ul>
            <li class="w85r b">配件小图标 </li>
            <li>
                <asp:FileUpload ID="fileUploadSmall" runat="server" CssClass="text" onchange="Validate()" />
            </li>
            <li>
                <img id="propsSmallImage" runat="server" alt="" src="" class="carimg" />
            </li>
            <li><span id="noSmallLogoSpan" class="warning1" style="display: none">请上传一张图片</span>
                <span id="errorSmallLogoSpan" class="warning1" style="display: none">请选择正确的图片格式</span></li>
        </ul>
        <ul>
            <li class="w85r b">配件大图标 </li>
            <li>
                <asp:FileUpload ID="fileUploadBig" runat="server" CssClass="text" onchange="Validate()" /></li>
            <li>
                <img id="propsBigImage" runat="server" alt="" src="" class="carimg" />
            </li>
            <li><span id="noBigLogoSpan" class="warning1" style="display: none">请上传一张图片</span> <span
                id="errorBigLogoSpan" class="warning1" style="display: none">请选择正确的图片格式</span></li>
        </ul>
        <ul>
            <li class="w85r b">X轴位置 </li>
            <li>
                <asp:TextBox ID="posXTextBox" runat="server" CssClass="text" onblur="Validate()"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" CssClass="warning" runat="server"
                    ControlToValidate="posXTextBox" ErrorMessage="请填写X轴位置" Display="Dynamic" ForeColor=""></asp:RequiredFieldValidator>
                <asp:RangeValidator ID="RangeValidator8" CssClass="warning" runat="server" ControlToValidate="posXTextBox"
                    ErrorMessage="请填写0－800之间的整数" Type="Integer" MinimumValue="0" MaximumValue="800"></asp:RangeValidator>
            </li>
        </ul>
        <ul>
            <li class="w85r b">Y轴位置 </li>
            <li>
                <asp:TextBox ID="posYTextBox" runat="server" CssClass="text" onblur="Validate()"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator6" CssClass="warning" runat="server"
                    ControlToValidate="posYTextBox" ErrorMessage="请填写Y轴位置" Display="Dynamic" ForeColor=""></asp:RequiredFieldValidator>
                <asp:RangeValidator ID="RangeValidator9" CssClass="warning" runat="server" ControlToValidate="posYTextBox"
                    ErrorMessage="请填写0－800之间的整数" Type="Integer" MinimumValue="0" MaximumValue="800"></asp:RangeValidator>
            </li>
        </ul>
        <ul>
            <li>
                <asp:HiddenField ID="actionTypeHidden" runat="server" Value="Add" />
                <asp:HiddenField ID="idHidden" runat="server" />
                <asp:Button ID="SaveButton" runat="server" CssClass="button" Text="保存" OnClick="Save" />
            </li>
        </ul>
    </div>
    <asp:Repeater ID="fittingsRepeater" runat="server" Visible="false" OnItemDataBound="Repeater_DataBound"
        OnItemCommand="Repeater_Command">
        <HeaderTemplate>
            <table class="tblist">
                <tr>
                    <th>
                        配件类型名称
                    </th>
                    <th>
                        提升速度
                    </th>
                    <th>
                        提升稳定性
                    </th>
                    <th>
                        适用车型名称
                    </th>
                    <th>
                        显示顺序
                    </th>
                    <th>
                        价格
                    </th>
                    <th>
                        X轴位置
                    </th>
                    <th>
                        Y轴位置
                    </th>
                    <th>
                    </th>
                </tr>
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <td>
                    <asp:HiddenField ID="idHidden" runat="server" />
                    <asp:Label ID="fittingsNameLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="fittingsSpeedLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="fittingsStabilityLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="fittingsFatherLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="displayOrderLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="priceLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="posXLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="posYLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:LinkButton ID="EditButton" runat="server" CssClass="btnsty" CausesValidation="false"
                        CommandName="Edit" Text="修改" />
                    <asp:LinkButton ID="DeleteButton" runat="server" CssClass="btnsty cred" CausesValidation="false"
                        CommandName="Delete" Text="删除" OnClientClick="return confirm('确定删除？')" />
                </td>
            </tr>
        </ItemTemplate>
        <FooterTemplate>
            </table>
        </FooterTemplate>
    </asp:Repeater>
    </form>
</body>
</html>
